export default{
	formatNum(num) {
	    let res = Number(num);
	    return res < 10 ? '0' + res : res;
	},
	getNewdate(){
		let date = new Date();
		let y = date.getFullYear();
		let m = date.getMonth();
		let d = date.getDate();
		let hour = date.getHours();
		let minute = date.getMinutes();
		let second = date.getSeconds();
		let datas = y + '-' + this.formatNum(m + 1) + '-' + this.formatNum(d)+' '+ hour+':'+minute+':'+second;
		return datas;
	},
	distance(la1, lo1, la2, lo2) {
		var La1 = la1 * Math.PI / 180.0;
		var La2 = la2 * Math.PI / 180.0;
		var La3 = La1 - La2;
		var Lb3 = lo1 * Math.PI / 180.0 - lo2 * Math.PI / 180.0;
		var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(La3 / 2), 2) + Math.cos(La1) * Math.cos(La2) * Math.pow(Math.sin(Lb3 / 2), 2)));
		s = s * 6378.137;//地球半径
		s = Math.round(s * 10000) / 10000;
		s = s.toFixed(1);
		return s
	}
}